<template>
  <div style="background-color: #f3f7f8;">
    <el-container>
      <el-header>
        <div class="logo"><img src="@/assets/5.jpg" alt="" /></div>
        <div class="header-nav">
          <div
            v-for="item in listArr"
            :key="item.label"
            class="list"
            :style="{ color: item.url == info ? '#ffff66' : '' }"
            @click="target(item.url)"
          >
       
            {{ item.label }}
            <el-divider direction="vertical"></el-divider>
          </div>
        
        </div>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
      <el-footer style="background-color: #fff;line-height:60px">
      @copyright    大学生士官网
      
      </el-footer>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      info: "",
      listArr: [
        { label: "首页", url: "/index/page4" },
        { label: "通知公告", url: "/index/page3" },
        { label: "国防知识", url: "/index/page2" },
        { label: "政策法规", url: "/index/page1" },
        { label: "后勤保障", url: "/index/page5" },
        { label: "退役管理", url: "/index/page6" },
        { label: "个人中心", url: "/index/page7" },
      ],
    };
  },
  created() {
    this.info = this.$route.fullPath
   
  },
  methods: {
    target(url) {
      console.log(url);
      this.info=url;
      this.$router.push(url);
    },
  },
};
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
.list {
  display: inline-block;
  padding: 0 10px;
}
.list:hover {
  color: #ffff66;
  text-decoration: underline;
}
.logo {
  width: 100%;
  height: 180px;
}
.logo > img {
  width: 100%;
  height: 100%;
}
.el-header {
  background-color: #b3c0d1;
  color: #333;
  width: 60%;
  margin: 0 auto;
  padding: 0 !important;
  height: auto !important;
  
}

.el-main {
  background-color: #fff;
  color: #333;
  text-align: center;
  height: auto;
  width: 60%;
  margin: 20px auto 0;
  border:2px solid #ccc;
}
.header-nav {
  width: 100%;
  height: 50px;
  /* background: red; */
  line-height: 50px;
  color: #fff;
}
</style>